<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('修改新员工登记')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
    <th:block th:include="include :: select2-css"/>
</head>
<body>
<div class="main-content">
    <form id="form-attNewRegister-edit" class="form-horizontal" AUTOCOMPLETE="OFF">
        <input name="id" id="id" type="hidden" th:value="${attendNewEmpRegister.id}"/>
        <h4 class="form-header h4">基本信息</h4>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">工号：</label>
                    <div class="col-sm-8">
                        <input name="badge" id="badge" th:value="${attendNewEmpRegister.badge}" class="form-control"
                               readonly="readonly" type="text"/>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">姓名：</label>
                    <div class="col-sm-8">
                        <input name="name" id="name" class="form-control" th:value="${attendNewEmpRegister.name}"
                               readonly="readonly" type="text"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">公司名称：</label>
                    <div class="col-sm-8">
                        <input name="CompId" id="CompId" th:value="${attendNewEmpRegister.compName}" readonly="readonly"
                               class="form-control" type="text"/>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">部门名称：</label>
                    <div class="col-sm-8">
                        <input name="DepId" id="DepId" class="form-control" th:value="${attendNewEmpRegister.depName}"
                               readonly="readonly" type="text"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">工作岗位：</label>
                    <div class="col-sm-8">
                        <input name="jobName" id="jobName" th:value="${attendNewEmpRegister.jobName}" readonly="readonly"
                               class="form-control" type="text"/>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">入职日期：</label>
                    <div class="col-sm-8">
                        <input name="joinDate" id="joinDate" th:value="${attendNewEmpRegister.joinDate}" readonly="readonly"
                               class="form-control" type="text"/>
                    </div>
                </div>
            </div>
        </div>

        <h4 class="form-header h4">变动信息</h4>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label"><span style="color: red; ">*</span>调动类型：</label>
                    <div class="col-sm-8">
                        <select name="ATStatus" id="ATStatus" class="form-control m-b"
                                th:with="type=${@dict.getType('aCD_ATStatus')}">
                            <option value="">请选择</option>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                    th:selected="${attendNewEmpRegister.ATStatus+'' == dict.dictValue}"
                                    th:value="${dict.dictValue}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label"><span style="color: red; ">*</span>考勤员工类型：</label>
                    <div class="col-sm-8">
                        <select name="ATEmpType" id="ATEmpType" class="form-control m-b"
                                th:with="type=${@dict.getType('ACD_ATEMPTYPE')}">
                            <option value="">请选择</option>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                    th:selected="${attendNewEmpRegister.ATEmpType+'' == dict.dictValue}"
                                    th:value="${dict.dictValue}"></option>
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">是否享有带薪事假：</label>
                    <div class="col-sm-8">
                        <select name="isDXSJ" id="isDXSJ" class="form-control">
                            <option value="">请选择</option>
                            <option value="1" th:selected="${attendNewEmpRegister.isDXSJ == true}">是</option>
                            <option value="0" th:selected="${attendNewEmpRegister.isDXSJ == false || attendNewEmpRegister.isDXSJ == '' }">否
                            </option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label"><span style="color: red; ">*</span>轮班组：</label>
                    <div class="col-sm-8">
                        <select name="GroupID" id="GroupID" class="form-control">
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label"><span style="color: red; ">*</span>考勤卡号：</label>
                    <div class="col-sm-8">
                        <input name="CardId" id="CardId" th:value="${attendNewEmpRegister.CardId}"
                               class="form-control" type="text" required />
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: datetimepicker-js"/>

<script th:inline="javascript">
    var prefix = ctx + "attendEmpManage/NewEmpRegister";

    $(function () {
        var lbz = [[${group}]];
        var GroupID = [[${attendNewEmpRegister.GroupID}]];
        $("#GroupID").empty();
        var html = "";
        html += "<option value=''>请选择</option>";
        for (var i = 0; i < lbz.length; i++) {
            html += "<option value='"
                + lbz[i].groupid
                + "'>"
                + lbz[i].title
                + "</option>";
        }
        $("#GroupID").append(html);

        $("#GroupID").find("option").each(function () {
            if ($(this).val() == GroupID) {
                $(this).attr("selected", true);
            }
        });
    });

    function submitHandler() {
        if ($.validate.form()) {
            var data = $("#form-attNewRegister-edit").serializeArray();
            var id = $("#id").val();
            var ATStatus = $("#ATStatus").val();
            var ATEmpType = $("#ATEmpType").val();
            var isDXSJ = $("#isDXSJ").val();
            var GroupID = $("#GroupID").val();
            var CardId = $("#CardId").val();
            if (ATStatus == "" || ATStatus == null) {
                $.modal.alertWarning("请选择调动类型!");
                return;
            } else if (ATEmpType == "" || ATEmpType == null) {
                $.modal.alertWarning("请选择考勤员工类型!");
                return;
            }else if (GroupID == "" || GroupID == null) {
                $.modal.alertWarning("请选择轮班组!");
                return;
            }
            data.push({"name": "id", "value": id});
            data.push({"name": "ATStatus", "value": ATStatus});
            data.push({"name": "ATEmpType", "value": ATEmpType});
            data.push({"name": "isDXSJ", "value": isDXSJ});
            data.push({"name": "GroupID", "value": GroupID});
            data.push({"name": "CardId", "value": CardId});
            $.operate.save(prefix + "/edit", data);
        }
    }


</script>


</body>
</html>